﻿@{
    Layout = "~/Views/Shared/_LayoutMain.cshtml";
    ViewBag.Title = "网非e学院--课程列表";
    var courseList = ViewBag.CourseList as List<XZL.Web.Entity.Course>;
}
<div class="courseListTitle">
    <div class="courseNavList" id="navTop">
        <div class="courseNav courseNav2 courseNavSel" onclick="document.location = '../../Course/Index'">
            全部
        </div>
        <div class="courseNav courseNav2" onclick="document.location = '../../Course/Index?Type=5'">
            最热
        </div>
    </div>
    <div id="navList">
        <div class="courseNavList navList" id="navList1">
            <div class="courseNav courseNav4 courseNavSel">
                情商育儿
            </div>
            <div class="courseNav courseNav4">
                学习方法
            </div>
            <div class="courseNav courseNav4">
                兴趣培养
            </div>
            <div class="courseNav courseNav4">
                留学攻略
            </div>
        </div>
        <div class="courseNavList navList" id="navList2" style="display:none">
            <div class="courseNav courseNav4 courseNavSel">
                最热
            </div>
            <div class="courseNav courseNav4">
                最新
            </div>
            <div class="courseNav courseNav4">
                免费
            </div>
            <div class="courseNav courseNav4">
                付费
            </div>
        </div>
    </div>
</div>

<div class="courseConList" id="courseConList">
    @foreach (var item in courseList)
    {
        <div class="courseBG" onclick="document.location='../../Course/CourseInfo?CourseID=@item.CourseID&InviteID=@ViewBag.InviteID'">
            <div class="courseItem">
                <img src="@item.CourseImg" class="courseImg" />
                <span class="courseText">
                    <span class="courseTitle">
                        @item.CourseName
                    </span><br />
                    <span>
                        开课时间：@item.StartTime.ToString("MM/dd HH:mm")
                    </span><br />
                    <span>
                        @item.TeacherName | @item.TeacherTitle1
                    </span><br />
                    <span>
                        @item.TeacherTitle2
                    </span>
                </span>
            </div>
        </div>
    }
</div>


<script>
    //顶部导航切换
    $("#navTop .courseNav").click(function () {
        $("#navTop .courseNav").removeClass("courseNavSel");
        var num = $("#navTop .courseNav").index(this);
        $(this).addClass("courseNavSel");
        $(".navList").hide();
        $(".navList").eq(num).show();
    })

    var type = @ViewBag.Num;
    //顶部导航默认选中
    if(type>4)
    {
        $("#navList1").hide();
        $("#navList2").show();
        $("#navTop .courseNav").removeClass("courseNavSel");
        $("#navTop .courseNav").eq(1).addClass("courseNavSel");
    }
    //二级导航默认选中
    $("#navList .courseNav").removeClass("courseNavSel");
    $("#navList .courseNav").eq(type - 1).addClass("courseNavSel");
    //二级导航切换
    $("#navList .courseNav").click(function () {
        var num = $("#navList .courseNav").index(this);
        location.href = "../../Course/Index?Type=" + (num + 1);
    })

    //课程列表通过图片计算显示大小
    var courseHight = ($(".courseImg").eq(0).width()) * 4 / 5;
    $(".courseItem").height(courseHight);
    $(".courseImg").height(courseHight);
    $(".courseText").height(courseHight);

    //底部导航选中
    $("#ImgKecheng").attr("src", "../../Image/logoKechengSel.png");
</script>
